package com.huluobo.higt4demo1911.utils.gift.impl;

import android.content.Context;

import com.huluobo.higt4demo1911.utils.gift.GiftBean;

/**
 * Created by lc on 2022/4/29.
 * 礼物工厂类
 */
public class GiftFactory implements IGiftFactory {
    @Override
    public IGiftView create(Context context, GiftBean giftBean) {
        switch (giftBean.type) {
            //根据不同类型展示不同的礼物View
            default:
                return new GiftDefView(context);
        }
    }

    //单例的第一步,私有化构造函数
    private static GiftFactory factory;

    //单例的第二步,对外暴露实例
    public static GiftFactory getInstance() {
        if (factory == null) {
            factory = new GiftFactory();
        }
        return factory;
    }
}
